<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //类继承 ES6写法 等同于ES5构造函数继承
        class Phone{
            constructor(brand, price) {
                this.brand = brand
                this.price = price
            }

            call() {
                console.log("打电话...")
            }
        }

        //继承
        class SmartPhone extends Phone {
            constructor(brand, price, color, size) {
                super(brand, price) //调用父类构造方法
                this.color = color
                this.size = size
            }

            //子类独有方法
            playGame() {
                console.log('玩游戏')
            }

            //重学父类方法
            call() {
                //super.call()//调用父类方法
                console.log('视频通话')
            }
        }

        let xiaomi = new SmartPhone('小米', 1999, '白色', '4.7英寸')
        console.log(xiaomi)
        xiaomi.call()
        xiaomi.playGame()
    </script>
</body>
</html>